import requests
from lxml import etree
base_url = "https://www.hbjcxy.com/jyyw/"
# 开启循环 5页
for i in range(0,5):
    if i==0:
        url = base_url+"index.html"
        response = requests.get(url)
        # 设置编码
        response.encoding = "utf-8"
        # 生成节点
        node = etree.HTML(response.text)
        # 解析节点
        titles = node.xpath("//div[@class='list-item']//a/text()")
        # 去除空格
        titles = [str(i).strip() for i in titles]
        print(titles)
    else:
        url = base_url+"index_"+str(i+1)+".html"
        response = requests.get(url)
        # 设置编码
        response.encoding = "utf-8"
        # 生成节点
        node = etree.HTML(response.text)
        # 解析节点
        titles = node.xpath("//div[@class='list-item']//a/text()")
        # 去除空格
        titles = [str(i).strip() for i in titles]
        print(titles)